#encoding: utf-8

class Editor::Api::TestsController < Editor::Api::BaseController
  
  def initialize
  end
  
  def items(params = {})
    p Test.where_by_params(params)
    items = []
    Test.find_each(:batch_size => 1000) do |test|
      items << {
        id: test.id,
        caption: test.caption
      }
    end
    return items
  end
  
  def item(id)
    test = Test.find(id)
    return {
        id: test.id,
        caption: test.caption
    }
  end
  
  def item_create(data)
    test = Test.create!(data)
    return {
        id: test.id,
        caption: test.caption
    }
  end
 
end
